<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<c:if test="${hour != appointEndTime[0]-1 or isEndHour}">
  <li class="item-content" style="padding-left: .75rem;${coachCourseSchedule.containsKey(dayhour) or coachCourseSchedule.containsKey(afterdayhour) ? 'color:#C7C7C7;' : ''}">
    <div class="item-inner">
      <div class="item-title-row">
        <div class="item-title" style="font-size: .8rem;"><strong>${hour}:30~${hour + 1}:30</strong></div>
      </div>
      <div class="item-subtitle" style="font-size: .6rem; max-height: 3rem; margin: 0px;">
        <c:if test="${currentSite.roomLimit.roomLimit > 0}">
          私人区域：${roomRecords[halfhour] == null ? 0 : roomRecords[halfhour]}/${currentSite.roomLimit.roomLimit}<br>
        </c:if>
        <c:if test="${currentSite.roomLimit.commonLimit > 0}">
          ${currentSite.fuxing ? '米域' : '公共区域' }：${commonRecords[halfhour] == null ? 0 : commonRecords[halfhour]}/${currentSite.roomLimit.commonLimit}
        </c:if>
      </div>
      <c:if test="${currentSite.roomLimit.commonLimit > 0 || currentSite.roomLimit.roomLimit > 0}">
        <div class="item-subtitle">
          <c:choose>
            <c:when test="${courseSchedule.dayhour == halfhour}">
              <a style="color: #000; padding:.3rem .7rem; height: 1.75rem;">已选</a>
            </c:when>
            <c:when test="${coachRestCalendars.containsKey(halfhour) or coachRestCalendars.containsKey(afterdayhour)}">
              <c:choose>
                <c:when test="${coachRestCalendars.containsKey(halfhour)}">
                  <a style="color: #999; padding:.3rem .7rem; height: 1.75rem;">${coachRestCalendars[halfhour].coachRestType.description}</a>
                </c:when>
                <c:when test="${coachRestCalendars.containsKey(afterdayhour)}">
                  <a style="color: #999; padding:.3rem .7rem; height: 1.75rem;">${coachRestCalendars[afterdayhour].coachRestType.description}</a>
                </c:when>
              </c:choose>
            </c:when>
            <c:when test="${courseSchedule.dayhour != halfhour and validatehalfhour}">
              <c:choose>
                <c:when test="${courseSchedule.dayhour == dayhour and not coachCourseSchedule.containsKey(afterdayhour)}">
                  <a href="#" data-hour="${hour}:30" class="booking-btn button fs-button button-fill" style="background-color: #FFDE00; color: #333; padding:.3rem .7rem; height: 1.75rem;">预约</a>
                </c:when>
                <c:when test="${courseSchedule.dayhour == afterdayhour and not coachCourseSchedule.containsKey(dayhour)}">
                  <a href="#" data-hour="${hour}:30" class="booking-btn button fs-button button-fill" style="background-color: #FFDE00; color: #333; padding:.3rem .7rem; height: 1.75rem;">预约</a>
                </c:when>
                <c:otherwise>
                  <a style="color: #000; padding:.3rem .7rem; height: 1.75rem;">上课</a>
                </c:otherwise>
              </c:choose>
            </c:when>
            <c:otherwise>
              <c:choose>
                <c:when test="${coachCourseSchedule.containsKey(halfhour)}">
                  <a style="color: #000; padding:.3rem .7rem; height: 1.75rem;">上课</a>
                </c:when>
                <c:when test="${coachCourseSchedule.containsKey(dayhour) or coachCourseSchedule.containsKey(afterdayhour)}">
                  <a style="color: #999; padding:.3rem .7rem; height: 1.75rem;">被占用</a>
                </c:when>
                <%-- <c:when test="${coachCourseSchedule.containsKey(beforehalfhour) or coachCourseSchedule.containsKey(afterhalfhour)}">
                   <a style="color: #000; padding:.3rem .7rem; height: 1.75rem;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                </c:when> --%>
                <c:otherwise>
                  <a href="#" data-hour="${hour}:30" class="booking-btn button fs-button button-fill" style="background-color: #FFDE00; color: #333; padding:.3rem .7rem; height: 1.75rem;">预约</a>
                </c:otherwise>
              </c:choose>
            </c:otherwise>
          </c:choose>
        </div>
      </c:if>
    </div>
  </li>
</c:if>
